-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow mixins on all shape types #1025
Merged
JordonPhillips
merged 10 commits into
smithy-lang:idl-2.0
from
JordonPhillips:expand-mixins
Jan 10, 2022
Merged
Allow mixins on all shape types #1025
JordonPhillips
merged 10 commits into
smithy-lang:idl-2.0
from
JordonPhillips:expand-mixins
Jan 10, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mtdowling
requested changes
Dec 22, 2021
.../test/resources/software/amazon/smithy/model/loader/valid/mixins/operations.flattened.smithy
Outdated
Show resolved
Hide resolved
.../resources/software/amazon/smithy/model/shapes/idl-serialization/cases/service-mixins.smithy
Show resolved
Hide resolved
smithy-utils/src/main/java/software/amazon/smithy/utils/SimpleParser.java
Show resolved
Hide resolved
smithy-model/src/main/java/software/amazon/smithy/model/loader/IdlModelParser.java
Outdated
Show resolved
Hide resolved
smithy-model/src/main/java/software/amazon/smithy/model/shapes/EntityShape.java
Outdated
Show resolved
Hide resolved
smithy-model/src/main/java/software/amazon/smithy/model/shapes/ServiceShape.java
Show resolved
Hide resolved
kstich
requested changes
Dec 22, 2021
smithy-model/src/main/java/software/amazon/smithy/model/loader/IdlModelParser.java
Outdated
Show resolved
Hide resolved
smithy-model/src/main/java/software/amazon/smithy/model/loader/IdlModelParser.java
Outdated
Show resolved
Hide resolved
smithy-model/src/main/java/software/amazon/smithy/model/shapes/Shape.java
Outdated
Show resolved
Hide resolved
JordonPhillips
force-pushed
the
expand-mixins
branch
from
December 23, 2021 15:00
a354204
to
52a7cad
Compare
JordonPhillips
force-pushed
the
expand-mixins
branch
from
January 3, 2022 15:18
1e97c8c
to
7ee04ee
Compare
This updates mixins to allow duplicating a mixin member on a shape, so long as the target remains the same. Members applied locally will behave the same way as they would if they were applied with the apply statement.
JordonPhillips
force-pushed
the
expand-mixins
branch
from
January 6, 2022 15:46
7ee04ee
to
44304ca
Compare
This reverts commit 11cb675.
mtdowling
requested changes
Jan 7, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good so far!
smithy-model/src/main/java/software/amazon/smithy/model/shapes/Shape.java
Outdated
Show resolved
Hide resolved
smithy-model/src/main/java/software/amazon/smithy/model/shapes/Shape.java
Outdated
Show resolved
Hide resolved
smithy-model/src/main/java/software/amazon/smithy/model/shapes/Shape.java
Show resolved
Hide resolved
smithy-model/src/main/java/software/amazon/smithy/model/shapes/Shape.java
Show resolved
Hide resolved
smithy-model/src/main/java/software/amazon/smithy/model/shapes/SmithyIdlModelSerializer.java
Show resolved
Hide resolved
mtdowling
requested changes
Jan 7, 2022
...c/test/resources/software/amazon/smithy/model/loader/invalid/mixins/with-on-next-line.smithy
Outdated
Show resolved
Hide resolved
smithy-model/src/main/java/software/amazon/smithy/model/loader/IdlModelParser.java
Outdated
Show resolved
Hide resolved
smithy-model/src/main/java/software/amazon/smithy/model/loader/IdlModelParser.java
Outdated
Show resolved
Hide resolved
smithy-model/src/main/java/software/amazon/smithy/model/loader/IdlModelParser.java
Outdated
Show resolved
Hide resolved
smithy-model/src/main/java/software/amazon/smithy/model/loader/IdlModelParser.java
Outdated
Show resolved
Hide resolved
mtdowling
approved these changes
Jan 10, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This expands mixins to allow them on any shape type.
One other thing that has been done is allowing shapes to re-define members. This could allow us to continue to require that lists / sets / maps always define their members. So instead of
You'd have
Trait merging works precisely like it does for the shapes themselves, which removes the need to have a bunch of awkward apply statements everywhere. The one restriction is that the target has to be the same shape.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.